from django.apps import AppConfig
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _

from eventyay import __version__ as version


class BankTransferApp(AppConfig):
    name = 'eventyay.plugins.banktransfer'
    verbose_name = _('Bank transfer')

    class EventyayPluginMeta:
        name = _('Bank transfer')
        category = 'PAYMENT'
        featured = True
        version = version
        description = _('This plugin allows you to receive payments ' + 'via bank transfer.')

    def ready(self):
        from . import signals  # NOQA

        # from . import tasks  # NOQA
        from .templatetags import commadecimal, dotdecimal  # NOQA

    @cached_property
    def compatibility_warnings(self):
        errs = []
        try:
            import chardet  # NOQA
        except ImportError:
            errs.append(_("Install the python package 'chardet' for better CSV import capabilities."))
        return errs


default_app_config = 'eventyay.plugins.banktransfer.BankTransferApp'
